package com.open.capacity.workflow3.controller;

import java.util.Map;

import com.open.capacity.commons.Result;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import com.open.capacity.workflow3.entity.NwfTask;
import com.open.capacity.workflow3.service.NwfTaskService;

import com.open.capacity.commons.PageResult;

import javax.validation.Valid;

/**
 * @author
 * @email
 * @date 2023-11-02 21:21:15
 */
@RestController
@RequestMapping("nwftask")
@Api(tags = "")
public class NwfTaskController {

    @Autowired
    private NwfTaskService nwfTaskService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @PreAuthorize("hasAnyAuthority('nwf_task:nwftask:list')")
    public PageResult list(@RequestParam Map<String, Object> params) {
//        PageResult pageResult = nwfTaskService.pageAll(params);
//        return pageResult;
        return null;
    }

    /**
     * 查询单条记录
     */
    @RequestMapping("/findById")
    @PreAuthorize("hasAnyAuthority('nwf_task:nwftask:list')")
    public Result findById(String id) {
//        return Result.succeed(nwfTaskService.findById(id));
        return null;
    }


    /**
     * 保存
     */
    @RequestMapping("/saveOrUpdate")
    @PreAuthorize("hasAnyAuthority('nwf_task:nwftask:save')")
    public Result save(@RequestBody @Valid NwfTask nwfTask, String keyValue) {
        if (StringUtils.isEmpty(keyValue)) {
//              nwfTaskService.save(nwfTask);
        } else {
            nwfTask.setId(keyValue);
//          nwfTaskService.update(nwfTask);
        }
        return Result.succeed("保存成功");
    }


    /**
     * 删除
     */
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("hasAnyAuthority('nwf_task:nwftask:delete')")
    public Result delete(@PathVariable String id) {
//            nwfTaskService.delete(id);
        return Result.succeed("删除成功");
    }

}
